package com.rays.sysmech.listeners;

import java.awt.Container;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import com.rays.sysmech.constants.StringConstants;
import com.rays.sysmech.core.DuplicateDataInfo;
import com.rays.sysmech.core.DuplicateFileProcessor;
import com.rays.sysmech.ui.MainWindow;
import com.rays.sysmech.utils.Pair;

public class StartBtnListner implements ActionListener {

	@Override
	public void actionPerformed(ActionEvent e) {
		MainWindow mainWnd = MainWindow.getMainWindow();
		Container containter = mainWnd.getContentPane();
		containter.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
		mainWnd.reset();
		File selectedFile = mainWnd.getSelectedFile();
		DuplicateDataInfo duplicateData = DuplicateFileProcessor.FindAllDuplicates(selectedFile);
		mainWnd.setSizeLabel(duplicateData.getTotalDuplicatedataSize());
		mainWnd.useDuplicatesData(duplicateData);
		
		
		containter.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

	}

}
